/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.recent;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "recent_clearing_exright")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RecentClearingExRight.findAll", query = "SELECT r FROM RecentClearingExRight r"),
    @NamedQuery(name = "RecentClearingExRight.findById", query = "SELECT r FROM RecentClearingExRight r WHERE r.id = :id"),
    @NamedQuery(name = "RecentClearingExRight.findByAccountCode", query = "SELECT r FROM RecentClearingExRight r WHERE r.accountCode = :accountCode"),
    @NamedQuery(name = "RecentClearingExRight.findByClearingDate", query = "SELECT r FROM RecentClearingExRight r WHERE r.clearingDate = :clearingDate"),
    @NamedQuery(name = "RecentClearingExRight.findByObj", query = "SELECT r FROM RecentClearingExRight r WHERE r.obj = :obj"),
    @NamedQuery(name = "RecentClearingExRight.findByMarketCode", query = "SELECT r FROM RecentClearingExRight r WHERE r.marketCode = :marketCode"),
    @NamedQuery(name = "RecentClearingExRight.findByClassCode", query = "SELECT r FROM RecentClearingExRight r WHERE r.classCode = :classCode"),
    @NamedQuery(name = "RecentClearingExRight.findByRecordeDate", query = "SELECT r FROM RecentClearingExRight r WHERE r.recordeDate = :recordeDate"),
    @NamedQuery(name = "RecentClearingExRight.findByPosQty", query = "SELECT r FROM RecentClearingExRight r WHERE r.posQty = :posQty"),
    @NamedQuery(name = "RecentClearingExRight.findByProfitsAmount", query = "SELECT r FROM RecentClearingExRight r WHERE r.profitsAmount = :profitsAmount"),
    @NamedQuery(name = "RecentClearingExRight.findByShareA", query = "SELECT r FROM RecentClearingExRight r WHERE r.shareA = :shareA"),
    @NamedQuery(name = "RecentClearingExRight.findByShareB", query = "SELECT r FROM RecentClearingExRight r WHERE r.shareB = :shareB"),
    @NamedQuery(name = "RecentClearingExRight.findByTax", query = "SELECT r FROM RecentClearingExRight r WHERE r.tax = :tax"),
    @NamedQuery(name = "RecentClearingExRight.findByNetProfitsAmount", query = "SELECT r FROM RecentClearingExRight r WHERE r.netProfitsAmount = :netProfitsAmount"),
    @NamedQuery(name = "RecentClearingExRight.findByReMark", query = "SELECT r FROM RecentClearingExRight r WHERE r.reMark = :reMark"),
    @NamedQuery(name = "RecentClearingExRight.findByOwnUserID", query = "SELECT r FROM RecentClearingExRight r WHERE r.ownUserID = :ownUserID"),
    @NamedQuery(name = "RecentClearingExRight.findByAlterUserID", query = "SELECT r FROM RecentClearingExRight r WHERE r.alterUserID = :alterUserID"),
    @NamedQuery(name = "RecentClearingExRight.findByCreateTime", query = "SELECT r FROM RecentClearingExRight r WHERE r.createTime = :createTime"),
    @NamedQuery(name = "RecentClearingExRight.findByTimeStamp", query = "SELECT r FROM RecentClearingExRight r WHERE r.timeStamp = :timeStamp")})
public class RecentClearingExRight implements Serializable {
	public static byte[] EnCode(RecentClearingExRight msg) throws IOException {
		Codec<RecentClearingExRight> Lcode = ProtobufProxy.create(RecentClearingExRight.class);
		return Lcode.encode(msg);
	}
	public static RecentClearingExRight DeCode(byte[] data) throws IOException {
	Codec<RecentClearingExRight> Lcode = ProtobufProxy.create(RecentClearingExRight.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    @Protobuf
	private Long id;
    @Basic(optional = false)
    @Column(name = "AccountCode")
    @Protobuf
	private String accountCode;
    @Basic(optional = false)
    @Column(name = "ClearingDate")
    @Temporal(TemporalType.DATE)
    private Date clearingDate;
	@Protobuf
	private long clearingDateL;
    @Basic(optional = false)
    @Column(name = "Obj")
    @Protobuf
	private String obj;
    @Basic(optional = false)
    @Column(name = "MarketCode")
    @Protobuf
	private String marketCode;
    @Basic(optional = false)
    @Column(name = "ClassCode")
    @Protobuf
	private String classCode;
    @Basic(optional = false)
    @Column(name = "RecordeDate")
    @Temporal(TemporalType.DATE)
    private Date recordeDate;
	@Protobuf
	private long recordeDateL;
    @Column(name = "PosQty")
    @Protobuf
	private Integer posQty;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "ProfitsAmount")
    @Protobuf
	private Float profitsAmount;
    @Column(name = "ShareA")
    @Protobuf
	private Integer shareA;
    @Column(name = "ShareB")
    @Protobuf
	private Integer shareB;
    @Column(name = "Tax")
    @Protobuf
	private Float tax;
    @Column(name = "NetProfitsAmount")
    @Protobuf
	private Float netProfitsAmount;
    @Column(name = "ReMark")
    private String reMark;
	@Protobuf
	private byte[] reMarkBit;
    @Column(name = "OwnUserID")
    @Protobuf
	private String ownUserID;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public RecentClearingExRight() {
    }

    public RecentClearingExRight(Long id) {
        this.id = id;
    }

    public RecentClearingExRight(Long id, String accountCode, Date clearingDate, String obj, String marketCode, String classCode, Date recordeDate) {
        this.id = id;
        this.accountCode = accountCode;
        this.clearingDate = clearingDate;
		this.clearingDateL = CodeTool.DateToLong(clearingDate);
        this.obj = obj;
        this.marketCode = marketCode;
        this.classCode = classCode;
        this.recordeDate = recordeDate;
		this.recordeDateL = CodeTool.DateToLong(recordeDate);
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getAccountCode() {
        return accountCode;
    }

    public void setAccountCode(String accountCode) {
        this.accountCode = accountCode;
    }

    public Date getClearingDate() {
        return clearingDate;
    }

    public void setClearingDate(Date clearingDate) {
        this.clearingDate = clearingDate;
        this.setClearingDateL(CodeTool.DateToLong(clearingDate));
    }

    public String getObj() {
        return obj;
    }

    public void setObj(String obj) {
        this.obj = obj;
    }

    public String getMarketCode() {
        return marketCode;
    }

    public void setMarketCode(String marketCode) {
        this.marketCode = marketCode;
    }

    public String getClassCode() {
        return classCode;
    }

    public void setClassCode(String classCode) {
        this.classCode = classCode;
    }

    public Date getRecordeDate() {
        return recordeDate;
    }

    public void setRecordeDate(Date recordeDate) {
        this.recordeDate = recordeDate;
		this.setRecordeDateL(CodeTool.DateToLong(recordeDate));
    }

    public Integer getPosQty() {
        return posQty;
    }

    public void setPosQty(Integer posQty) {
        this.posQty = posQty;
    }

    public Float getProfitsAmount() {
        return profitsAmount;
    }

    public void setProfitsAmount(Float profitsAmount) {
        this.profitsAmount = profitsAmount;
    }

    public Integer getShareA() {
        return shareA;
    }

    public void setShareA(Integer shareA) {
        this.shareA = shareA;
    }

    public Integer getShareB() {
        return shareB;
    }

    public void setShareB(Integer shareB) {
        this.shareB = shareB;
    }

    public Float getTax() {
        return tax;
    }

    public void setTax(Float tax) {
        this.tax = tax;
    }

    public Float getNetProfitsAmount() {
        return netProfitsAmount;
    }

    public void setNetProfitsAmount(Float netProfitsAmount) {
        this.netProfitsAmount = netProfitsAmount;
    }

    public String getReMark() {
        return reMark;
    }

    public void setReMark(String reMark) {
        this.reMark = reMark;
		this.setReMarkBit(CodeTool.StringToBit(reMark));
    }

    public String getOwnUserID() {
        return ownUserID;
    }

    public void setOwnUserID(String ownUserID) {
        this.ownUserID = ownUserID;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RecentClearingExRight)) {
            return false;
        }
        RecentClearingExRight other = (RecentClearingExRight) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.recent.RecentClearingExRight[ id=" + id + " ]";
    }

    public long getClearingDateL() {
        return clearingDateL;
    }

    public void setClearingDateL(long clearingDateL) {
        this.clearingDateL = clearingDateL;
		this.clearingDate = CodeTool.LongToDate(clearingDateL);
    }

    public long getRecordeDateL() {
        return recordeDateL;
    }

    public void setRecordeDateL(long recordeDateL) {
        this.recordeDateL = recordeDateL;
		this.recordeDate = CodeTool.LongToDate(recordeDateL);
    }

    public byte[] getReMarkBit() {
        return reMarkBit;
    }

    public void setReMarkBit(byte[] reMarkBit) {
        this.reMarkBit = reMarkBit;
		this.reMark = CodeTool.BitToString(reMarkBit);
    }
    
}
